#!/usr/bin/env bash
# -*- coding:utf-8 -*-
# 修复EOF问题

# fixLines=`sed -n '/^error: Cannot fetch /p' | sed 's/error: Cannot fetch //g' | cut -d ' ' -f 1`
fixLines=`sed -n '/.:/p' | sed '/remote: /d' | sed '/error: /d' | sed '/fatal: /d' | sed '/Feching orojects: /d' | sed 's/://g'`
let fixLinesCount=0
for line in $fixLines
do
let fixLinesCount=fixLinesCount+1
done
echo "已发现$fixLinesCount个异常项目："

for line in $fixLines
do
echo $line
done

echo ""

for line in $fixLines
do
echo "=========== 开始重新同步$line ==========="
echo "开始执行 -> ./repo_cn sync -j1 $line"
./repo_cn sync -j1 $line
done


echo "全部完成！"
